#include <iostream>
using namespace std;
int main()
{
	int nums[] = { 4,3,2,7,8,2,3,1 };
	int sz = sizeof(nums) / sizeof(nums[0]);
	int ret[10] = { 0 };
	for (int i = 0; i < sz; i++)
	{
		if (nums[i] > 0)
		{
			int tmp1 = nums[i];
			if (nums[tmp1-1] > 0)
				nums[tmp1 - 1] *= (-1);
			else
				nums[tmp1 - 1] *= 1;
		}
		else
		{
			int tmp2 = (nums[i] * (-1));
			if (nums[tmp2-1] > 0)
				nums[tmp2 - 1] *= (-1);
			else
				nums[tmp2 - 1] *= 1;
		}
	}
	for (int i = 0; i < sz; i++)
	{
		if (nums[i] > 0)
		{
			ret[i] = i + 1;
		}
	}
	for (int i = 0; i < sz; i++)
	{
		cout << ret[i] << "  ";
	}
	cout << endl;
	system("pause");
	return 0;
}